function start() {
    status = -1;
    action(1, 0, 0);
}
function action(mode, type, selection) {
    if (mode == -1) {
        im.dispose();
    }
    else {
        if (status >= 0 && mode == 0) {
            im.sendOk("感谢你的光临！");
            im.dispose();
            return;
        }
        if (mode == 1) {
            status++;
        }
        else {
            status--;
        }
        if (status == 0) {
            var tex2 = "";
            var text = ""; 
            text += "#e#b点击下方红色选项随机抽取105-200武器#r\r\n\r\n"
            text += "#L1#随机抽取一次 105 - 200 武器#l\r\n"//3
			//text += "#L2#Bwuqi#l\r\n"//3
            im.sendSimple(text);
        }else if(status == 1){
			if (selection == 1) {
				var number = random(1,65); 
				randomCreateWuqi(number);
			}else{
				im.dispose();
			}
			
		} 
		
    }
}

function random(lower, upper) {
	return Math.floor(Math.random() * (upper - lower)) + lower;
}

function createWuqi(id,liliang,minjie,zhili,yunqi,goongji,mofa,name){
	if (im.getInventory(1).isFull(0)){//判断第四个也就是其它栏的装备栏是否有一个空格
		   im.sendOk("#b装栏空间不足1格.");	
		   im.dispose();
	}else{
		
		
		im.gainItem(id,liliang,minjie,zhili,yunqi,0,0,goongji,mofa,0,0,0,0,0,0);

		im.used();
		im.sendOk("领取成功！");
		im.全服漂浮喇叭("[随机武器箱子]" + " : " + "恭喜玩家[" +im.getName()+ "]打开了随机武器箱子,获得"+name+"!", 5120002)
		//im.喇叭(2,"玩家：["+im.getName()+"]打开了随机武器箱子,获得"+name+"!");
		im.dispose();
	}
}
function randomCreateWuqi(number){
	switch(number){
	case 1:
		createWuqi(2614000,1"[革ming双手剑]");
		break;                                 
	case 2:                                    
		createWuqi(1402210,20,20,20,20,110,1," [革ming双手剑]");
		break;                                 
	case 3:                                    
		createWuqi(1312165,20,20,20,20,100,1," [革ming单手斧]");
		break;                                 
	case 4:                                    
		createWuqi(1412147,20,20,20,20,110,1," [革ming双手斧]");
		break;                                 
	case 5:                                    
		createWuqi(1322215,20,20,20,20,100,1," [革ming单手锤]");
		break;                         
	case 6:                            
		createWuqi(1422152,20,20,20,20,110,1," [革ming双手锤]");
		break;                                 
	case 7:                                    
		createWuqi(1372188,30,30,30,30,1,115," [革ming短圣仗]");
		break;                                 
	case 8:                                    
		createWuqi(1382222,30,30,30,30,1,125," [革ming长圣仗]");
		break;                                 
	case 9:                                    
		createWuqi(1432178,20,20,20,20,110,1," [革ming战斗枪]");
		break;                                 
	case 10:                                   
		createWuqi(1442234,20,20,20,20,100,1," [革ming战斗矛]");
		break;                                 
	case 11:                                   
		createWuqi(1452216,20,20,20,20,95 ,1," [革ming战斗弓]");
		break;                                 
	case 12:                                   
		createWuqi(1462204,20,20,20,20,100,1," [革ming黑暗弩]");
		break;                                 
	case 13:                                   
		createWuqi(1332238,20,20,20,20,100,1," [革ming切割者]");
		break;                                 
	case 14:                                   
		createWuqi(1472226,20,20,20,20,60,1 ," [革ming战斗拳]");
		break;                                 
	case 15:                                   
		createWuqi(1482179,20,20,20,20,80,1 ," [革ming冲指节]");
		break;                                 
	case 16:                                   
		createWuqi(1492190,20,20,20,20,80,1 ," [革ming红杰克]");
		break;
	///////////	
	case 17:
		createWuqi(1302314,30,30,30,30,130,1 ," [伽耶汉单手剑]");
		break;                                  
	case 18:                                    
		createWuqi(1402235,30,30,30,30,140,1 ," [伽耶汉双手剑]");
		break;                                  
	case 19:                                    
		createWuqi(1312184,30,30,30,30,130,1 ," [伽耶汉单手斧]");
		break;                                  
	case 20:                                    
		createWuqi(1412163,30,30,30,30,140,1 ," [伽耶汉双手斧]");
		break;                                 
	case 21:                                   
		createWuqi(1322235,30,30,30,30,130,1 ," [伽耶汉单手锤]");
		break;                                  
	case 22:                                    
		createWuqi(1422170,30,30,30,30,140,1 ," [伽耶汉双手锤]");
		break;                                  
	case 23:                                    
		createWuqi(1372206,45,45,45,45,1,160 ," [伽耶汉短圣仗]");
		break;                                  
	case 24:                                    
		createWuqi(1382244,45,45,45,45,1,170 ," [伽耶汉长圣仗]");
		break;                                  
	case 25:                                    
		createWuqi(1432199,30,30,30,30,140,1 ," [伽耶汉战斗枪]");
		break;                                  
	case 26:                                    
		createWuqi(1442253,30,30,30,30,130,1 ," [伽耶汉开山矛]");
		break;                                  
	case 27:                                    
		createWuqi(1452237,30,30,30,30,130,1 ," [伽耶汉战斗弓]");
		break;                                  
	case 28:                                    
		createWuqi(1462224,30,30,30,30,140,1 ," [伽耶汉战斗弩]");
		break;                                  
	case 29:                                    
		createWuqi(1332259,30,30,30,30,140,1 ," [伽耶汉小短刀]");
		break;                                  
	case 30:                                    
		createWuqi(1472246,30,30,30,30,80 ,1 ," [伽耶汉战斗拳]");
		break;                                  
	case 31:                                    
		createWuqi(1482201,30,30,30,30,100,1 ," [伽耶汉冲指节]");
		break;                                   
	case 32:                                     
		createWuqi(1492211,30,30,30,30,100,1 ," [伽耶汉小短枪]");
		break;
	///////////	
	case 33:
		createWuqi(1302275,50,50,50,50,170,1," [法弗纳单手剑]");
		break;                                 
	case 34:                                   
		createWuqi(1402196,50,50,50,50,180,1," [法弗纳双手剑]");
		break;                                 
	case 35:                                   
		createWuqi(1312153,50,50,50,50,170,1," [法弗纳单手斧]");
		break;                                 
	case 36:                                   
		createWuqi(1412135,50,50,50,50,180,1," [法弗纳双手斧]");
		break;                                 
	case 37:                                   
		createWuqi(1322203,50,50,50,50,170,1," [法弗纳单手锤]");
		break;                                
	case 28:                                  
		createWuqi(1422140,60,60,60,60,180,1," [法弗纳双手锤]");
		break;                                 
	case 39:                                   
		createWuqi(1372177,75,75,75,75,1,220," [法弗纳短圣仗]");
		break;                                 
	case 40:                                   
		createWuqi(1382208,75,75,75,75,1,230," [法弗纳长圣仗]");
		break;                                
	case 41:                                   
		createWuqi(1432167,50,50,50,50,180,1," [法弗纳战斗枪]");
		break;                                 
	case 42:                                   
		createWuqi(1442223,50,50,50,50,170,1," [法弗纳开山矛]");
		break;                                 
	case 43:                                   
		createWuqi(1452205,50,50,50,50,170,1," [法弗纳战斗弓]");
		break;                                 
	case 44:                                   
		createWuqi(1462193,50,50,50,50,180,1," [法弗纳战斗弩]");
		break;                                 
	case 45:                                   
		createWuqi(1332225,50,50,50,50,180,1," [法弗纳小短刀]");
		break;                                 
	case 46:                                   
		createWuqi(1472214,50,50,50,50,110,1," [法弗纳战斗拳]");
		break;                                 
	case 47:                                   
		createWuqi(1482168,50,50,50,50,130,1," [法弗纳冲指节]");
		break;                                 
	case 48:                                   
		createWuqi(1492179,50,50,50,50,130,1," [法弗纳小短枪]");
		break;
	///////////	
	case 49:
		createWuqi(1302343,100,100,100,100,240,1," [神秘之影单手剑]");
		break;                                     
	case 50:                                       
		createWuqi(1402259,100,100,100,100,250,1," [神秘之影双手剑]");
		break;                                     
	case 51:                                       
		createWuqi(1312203,100,100,100,100,240,1," [神秘之影单手斧]");
		break;                                     
	case 52:                                       
		createWuqi(1412181,100,100,100,100,250,1," [神秘之影双手斧]");
		break;                                     
	case 53:                                       
		createWuqi(1322255,100,100,100,100,240,1," [神秘之影单手锤]");
		break;                                     
	case 54:                                       
		createWuqi(1422189,100,100,100,100,250,1," [神秘之影双手锤]");
		break;                                     
	case 55:                                       
		createWuqi(1372228,150,150,150,150,1,340," [神秘之影短圣仗]");
		break;                                     
	case 56:                                       
		createWuqi(1382265,150,150,150,150,1,350," [神秘之影长圣仗]");
		break;                                     
	case 57:                                       
		createWuqi(1432218,100,100,100,100,250,1," [神秘之影战斗枪]");
		break;                                     
	case 58:                                       
		createWuqi(1442274,100,100,100,100,240,1," [神秘之影开山矛]");
		break;                                     
	case 59:                                       
		createWuqi(1452257,100,100,100,100,240,1," [神秘之影战斗弓]");
		break;                                    
	case 60:                                      
		createWuqi(1462243,100,100,100,100,250,1," [神秘之影战斗弩]");
		break;                                     
	case 61:                                       
		createWuqi(1332279,100,100,100,100,250,1," [神秘之影小短刀]");
		break;                                     
	case 62:                                       
		createWuqi(1472265,100,100,100,100,150,1," [神秘之影战斗拳]");
		break;                                     
	case 63:                                       
		createWuqi(1482221,100,100,100,100,180,1," [神秘之影冲指节]");
		break;                                     
	case 64:                                       
		createWuqi(1492235,100,100,100,100,180,1," [神秘之影小短枪]");
		break;
		
		
		
		
 }
}
function packageHave(type,number){
	var object = -1;
	var count = 0;
	var flag = true;
	for(var i = 0;i<32;i++){
		object = im.getInventory(type).getItem(i);
		if(null == object){
			count++;
			if(count>=number){
				flag = false;
				break;
			}
		}
	}
	return flag;
}
